#ifndef NWIDGET_H
#define NWIDGET_H
#undef Attribute
#include "solar/beacon/Field.h"
#include <QtWidgets>
#include "tools/Gadget.h"

class Nwidget : public QWidget{

    Q_OBJECT

public:

    QStringList Evlist = {MSEVKEY.WIN_NORMAL,
                          MSEVKEY.WIN_LEAVE,
                          MSEVKEY.WIN_ENTER,
                          MSEVKEY.WIN_PRESS,
                          MSEVKEY.WIN_RELEASE};

    Nwidget(bool autoclose,
            int closewait = 5000,
            QWidget *parent = nullptr,
            Qt::WindowFlags flags = Qt::WindowFlags());

    Nwidget(QWidget *parent = nullptr,
            Qt::WindowFlags flags = Qt::WindowFlags());

    void doconfigur_direction(NT::CST_BRIGHT_SPOT direction);

    void doconfigur_autoclose(bool autoclose);

    void doconfigur_autoclosewait(int closewait);

    void doconfigur_iserpixmap(QList<std::pair<QString, int>> insert_pixmap);

    void doconfigur_iserpixmapmode(QList<std::pair<NT::WIN_ATTRIBUTE, int>> insert_pixmapmode);

    void doconfigur_secolor(QList<QList<QColor>> secolor);

    void doconfigur_secolor(QList<QList<QString>> secolor);

    void doconfigur_secolor(QList<QColor> secolor);

    void doconfigur_secolor(QColor secolor);

    void doconfigur_pixmap(QVariant curtain, QSize fsize, bool hiq, int redius);

    void doconfigur_pixmap(QVariant curtain, QSize fsize);

    void doconfigur_pixmap(QVariant curtain);

    void doconfigur_pixmap(QSize fsize, bool hiq, int redius);

    void doconfigur_pixmap(int redius);

    void doconfigur_pixmap(QSize fsize);

    void doconfigur_iserpixmapdel();

    void doconfigur_secolordel();

    void setVisible(bool visible);

    void update_pixmap(QSize adjusted);

protected:
    void paintEvent(QPaintEvent *Event);
    void doconfigur_init(bool autoclose, int closewait);
    bool eventFilter(QObject *watched, QEvent *event);
    MOUSE_ATTRIBUTE MSEVKEY;

signals:
    void msev_cspre(QCursor);
    void msev_pre(QMouseEvent *);
    void msev_rls(QMouseEvent *);
    void msev_mv(QMouseEvent *);
    void msev_lve(std::pair<bool, QString>);
    void msev_etr(std::pair<bool, QString>);
    void msnm_rls(QString);

private:
    QTimer autoTimer;
    Extend definfc;
    KEY_ATTRIBUTE RPLKEY;
    QMap<QString, QList<std::pair<QString, int>>> impact_istpixmap;
    QMap<QString, QList<std::pair<NT::WIN_ATTRIBUTE, int>>> impact_istpixmapmode;
    QMap<QString, QList<QList<QColor>>> impact_colorlist;
};

#endif
